<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:composite="http://java.sun.com/jsf/composite">

<composite:interface>
	<composite:attribute name="editavel" default="true"/>
	<composite:attribute name="valor" required="true"/>
	<composite:attribute name="padrao" default="dd/MM/yyyy"/>
	<composite:attribute name="maxLength" default="10" />
	<composite:attribute name="size" default="10" />
	<composite:attribute name="label" required="true"/>
	<composite:attribute name="obrigatorio" default="true"/>
	<composite:attribute name="titulo"/>
	<composite:attribute name="conversor" default="LocalDateConverter" />
</composite:interface>

<composite:implementation>

	<h:outputText id="#{cc.id}_DateLabel" value="#{cc.attrs.valor}" converter="#{cc.attrs.conversor}" rendered="#{not cc.attrs.editavel}" style="font-weight:normal;" >
		<f:converter converterId="#{cc.attrs.conversor}" />	
	</h:outputText>

	<p:calendar id="#{cc.id}_Date" value="#{cc.attrs.valor}" locale='pt_BR'  mode="popup" autocomplete="off" 
				pattern="#{cc.attrs.padrao}" maxlength="#{cc.attrs.maxLength}" size="#{cc.attrs.size}" rendered="#{cc.attrs.editavel}" label="#{cc.attrs.label}" 
				title="#{cc.attrs.titulo}" yearRange="1900:c+10" navigator="true" showOn="button" required="#{cc.attrs.obrigatorio}">
	
		<f:converter converterId="#{cc.attrs.conversor}" />
	</p:calendar>
		
<script>	
	$(document).ready(function(){
		$('input[id*="#{cc.id}_Date"]').each(function(){
			$(this).mask('99/99/9999');
		});
	});
	
</script>
<script>
PrimeFaces.locales['pt_BR'] = {
	    closeText : 'Fechar',
	    prevText : 'Anterior',
	    nextText : 'Próximo',
	    currentText : 'Começo',
	    monthNames : [ 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho','Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ],
	    monthNamesShort : [ 'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago','Set', 'Out', 'Nov', 'Dez'],
	    dayNames : [ 'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta','Sábado' ],
	    dayNamesShort : [ 'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb' ],
	    dayNamesMin : [ 'D', 'S', 'T', 'Q', 'Q', 'S', 'S' ],
	    weekHeader : 'Semana',
	    firstDay : 1,
	    isRTL : false,
	    showMonthAfterYear : false,
	    yearSuffix : '',
	    timeOnlyTitle : 'Só Horas',
	    timeText : 'Tempo',
	    hourText : 'Hora',
	    minuteText : 'Minuto',
	    secondText : 'Segundo',
	    ampm : false,
	    month : 'Mês',
	    week : 'Semana',
	    day : 'Dia',
	    allDayText : 'Todo Dia'
	};
</script>



</composite:implementation>
</html>